<template>
    <div class="home">
      <div>
        <input type="text" v-model="username">
        <button @click="login">
          登录
        </button>
      </div>
    </div>
  </template>
  
  <script>
  // @ is an alias to /src
  import HelloWorld from '@/components/HelloWorld.vue'
  
  export default {
    name: 'HomeView',
    data(){
      return {
        username:123
      }
    },
    components: {
      HelloWorld
    },
    methods:{
      login(){
        localStorage.setItem("token",this.username)
        this.$router.push("/")
      }
    }
  }
  </script>
  